<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>JS 事件机制</title>
    <style>
        #parent{
            width: 200px;
            height: 200px;
            background-color: red;
        }
        #child{
            width: 100px;
            height: 100px;
            background-color: blue;
        }
    </style>
</head>
<body>
    <div id="parent">
        <div id="child">

        </div>
    </div>
    <script>
         document.getElementById('parent').addEventListener('click', function() {
    console.log('parent click');
  })
  document.getElementById('child').addEventListener('click', function(event) {
    event.stopPropagation();
    console.log('clild click');
  })
    </script>
</body>
</html>